package com.csd.activity;

import java.util.LinkedList;
import java.util.List;

import android.app.ActionBar;
import android.app.Activity;
import android.app.Application;
import android.app.ActionBar.LayoutParams;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class CsdApplication extends Application {

	private List<Activity> activityList = new LinkedList<Activity>();
	private static CsdApplication instance;
	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
	}
	/**
	 * 开放给外界的获取本应用对象实例的静态方法
	 * 
	 * @return
	 */

	public static CsdApplication getInstance() {
		if (null == instance) {
			instance = new CsdApplication();
		}
		return instance;
	}
	
    /**
     *  添加Activity到容器中  
     * @param activity
     */
    public void addActivity(Activity activity) {  
        activityList.add(activity);  
    }  
	/**
	 * 关闭activity
	 */
	public void exit() {
		for (Activity activity : activityList) {
			if (activity != null) {
				activity.finish();
			}
		}
	}
	
	public static void showContent(LinearLayout ll,Context context){
		ll.setVisibility(View.VISIBLE);
		DisplayMetrics dm = new DisplayMetrics();
		dm = context.getApplicationContext().getResources()
				.getDisplayMetrics();
		int screenHeight = dm.heightPixels;
		AnimationSet animationSet = new AnimationSet(true);
		TranslateAnimation animation = new TranslateAnimation(0,
				0, screenHeight, 0);
		animation.setDuration(1000);
		animationSet.addAnimation(animation);
		ll.startAnimation(animationSet);
	}
	
	

}
